#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include "file.h"


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQmlApplicationEngine engine;
    const QUrl url(u"qrc:/ImageEditTool/main.qml"_qs);
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);


    file myFile;
    engine.rootContext()->setContextProperty("myFile", &myFile); // 将C++类添加进QML使用

    engine.load(url);

    return app.exec();
}
